const express = require('express');
const router = express.Router();
const ImportController = require('../controllers/ImportController');
const authenticate = require('../middleware/auth');

/**
 * @swagger
 * tags:
 *   name: Import
 *   description: 数据导入
 */

// All routes require authentication
router.use(authenticate);

/**
 * @swagger
 * /api/import/bills:
 *   post:
 *     summary: 从Excel/CSV文件导入账单数据
 *     tags: [Import]
 *     security:
 *       - bearerAuth: []
 *     requestBody:
 *       required: true
 *       content:
 *         multipart/form-data:
 *           schema:
 *             type: object
 *             properties:
 *               file:
 *                 type: string
 *                 format: binary
 *                 description: Excel或CSV文件
 *     responses:
 *       200:
 *         description: 账单导入成功
 *       400:
 *         description: 文件格式错误或缺少文件
 *       401:
 *         description: 未授权
 *       500:
 *         description: 服务器内部错误
 */
router.post('/bills', ImportController.importBills);

module.exports = router;